﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Com.CMS263.PO;
using Com.CMS263.BLL;
using Com.CMS263.Util;

namespace Com.CMS263.Web.manage.ManagerCategory
{
    public partial class CategoryList : System.Web.UI.Page
    {


        public int ListCount = 0;
        public int pageindex = 1;
        public int pagesize = 15;
        public string key = null;
        public IList<Category> list = new List<Category>();
        CategoryBLL caBll = new CategoryBLL();
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                pageindex = Convert.ToInt32(Request.QueryString["page"]);
                if (pageindex == 0)
                { pageindex = 1; }
                ListCount = caBll.FindAll().Count;
                ViewState["key"] = Request["key"];
                key = Request["key"];
                if (key != null && key != "")
                {
                    ListCount = caBll.FindListByKey(key);
                }
                list = caBll.FindListByKey(key, pagesize, pageindex);
            }
            catch { }
        }


        public string GetPager()
        {
            return EnPager.GetPager(ListCount, pagesize, pageindex, "&key=" + ViewState["key"]);
        }
    }
}
